import koaBodyParser from 'koa-bodyparser'
import koaJson from 'koa-json'
import session from 'koa-generic-session'
import Redis from 'koa-redis'
import passport from '../utils/passport'
export const bodyParser = (app) => {
  app.use(koaBodyParser())
}
export const json = (app) => {
  app.use(koaJson())
}

export const addSession = app => {
  app.keys = ['mt', 'keyskeys']
  app.proxy = true
  app.use(session({
    key: 'mt',
    prefix: `mt:uid`,
    store: new Redis()
  }))
}

export const addPassport = app => {
  app.use(passport.initialize())
  app.use(passport.session())
}
